<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>PhotoSphereViewer - equirectangular demo</title>

  <link rel="stylesheet" href="../dist/photo-sphere-viewer.css">

  <style>
    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
      margin: 0;
      padding: 0;
    }

    #photosphere {
      width: 100%;
      height: 100%;
    }

    .psv-button.custom-button {
      font-size: 22px;
      line-height: 20px;
    }
  </style>
</head>
<body>

<div id="photosphere"></div>

<script src="../node_modules/three/build/three.js"></script>
<script src="../node_modules/promise-polyfill/dist/polyfill.js"></script>
<script src="../node_modules/uevent/browser.js"></script>
<script src="../node_modules/nosleep.js/dist/NoSleep.js"></script>
<script src="../dist/photo-sphere-viewer.js"></script>
<script src="../dist/plugins/gyroscope.js"></script>
<script src="../dist/plugins/stereo.js"></script>

<script>
  var panos = [
    {
      url : 'sphere.jpg',
      desc: 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
    },
    {
      url : 'test-sphere.jpg',
      desc: 'Test sphere',
    },
  ];

  var PSV = new PhotoSphereViewer.Viewer({
    container          : 'photosphere',
    panorama           : panos[0].url,
    caption            : panos[0].desc,
    loadingImg         : 'assets/photosphere-logo.gif',
    // fisheye            : true,
    // touchmoveTwoFingers: true,
    // captureCursor      : true,
    navbar             : [
      'autorotate', 'zoom', 'download',
      {
        title    : 'Change image',
        className: 'custom-button',
        content  : '🔄',
        onClick  : (function () {
          var i = 0;

          return function () {
            i = 1 - i;

            PSV.setPanorama(panos[i].url, { longitude: 0, latitude: 0, zoom: 50 })
              .then(function () {
                PSV.navbar.setCaption(panos[i].desc);
              }, function () {});
          };
        }()),
      },
      {
        title    : 'Random position',
        className: 'custom-button',
        content  : '🔀',
        onClick  : function () {
          PSV.animate({
            longitude: (Math.random() - 0.5) * 3 / 2 * Math.PI,
            latitude : (Math.random() - 0.5) * 3 / 4 * Math.PI,
            zoom     : Math.random() * 60 + 20,
            speed    : 1500,
          });
        },
      },
      'caption', 'gyroscope', 'stereo', 'fullscreen',
    ],
    plugins            : [
      PhotoSphereViewer.GyroscopePlugin,
      PhotoSphereViewer.StereoPlugin,
    ]
  });

</script>
</body>
</html>
